package old_go_learn

import (
	"encoding/json"
	"fmt"
)

type IT struct {
	Company  string   `json:"company"`
	Subjects []string `json:"-"`
	IsOk     bool     `json:"is_ok,string"`
	Price    float64  `json:"price,string"`
}

type A struct {
	Name string `json:"name"`
	Sex string  `json:"sex"`
	Age int		`json:"age"`
}

func main() {

	a:=A{"zs","男",18}
	json1,err:=json.Marshal(a)
	fmt.Println(string(json1))


	s := IT{"name", []string{"go", "c++"}, true, 66.66}
	jsonStr, err := json.Marshal(s)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println(string(jsonStr))
	}

}
